﻿namespace MvcXRepairCustomer.Services
{
    using System;
    using System.Collections.Generic;
    using MvcXRepairCustomer.Interfaces;
    using MvcXRepairCustomer.Repository.SQL;
    using XRepair.Models;

    public class BrandService : IBrandService
    {
        private BrandDAO _brandRepository;

        public BrandService()
        {
            _brandRepository = new BrandDAO();
        }

        public IEnumerable<Brand> GetAllActiveBrands()
        {
            return _brandRepository.GetAllActiveBrands();
        }

        public bool DeactivateBrandByID(int id)
        {
            return _brandRepository.DeactivateBrandByID(id);
        }

        public bool AddNewBrand(Brand brand)
        {
            brand.CreatedAt = DateTime.Now;
            brand.LastUpdatedAt = DateTime.Now;

            return _brandRepository.AddNewBrand(brand);
        }

        public bool UpdateBrand(Brand brand)
        {
            brand.LastUpdatedAt = DateTime.Now;

            return _brandRepository.UpdateBrand(brand);
        }
    }
}
